Move garmin special functions and data to garmin_tables.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 5 Apr 2006 18:08:13 +0000 (18:08 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 5 Apr 2006 18:08:13 +0000 (18:08 +0000)
gpsbabel/bcr.c
gpsbabel/garmin_tables.c
gpsbabel/garmin_tables.h
gpsbabel/gpilots.c
gpsbabel/mapsource.c
gpsbabel/pcx.c
gpsbabel/psitrex.c

index 3216f88f1e2d454f8161919fb111700b6a76ca04..c64104a7548e7c08e51547cef31935daa21fb209 100644 (file)
@@ -183,9 +183,9 @@ bcr_data_read(void)
                        }
                        
                        if (case_ignore_strcmp(str, "Standort") == 0)
-                           wpt->icon_descr = mps_find_desc_from_icon_number(18, MAPSOURCE);
+                           wpt->icon_descr = gt_find_desc_from_icon_number(18, MAPSOURCE, NULL);
                        else if (case_ignore_strcmp(str, "Town") == 0)
-                           wpt->icon_descr = mps_find_desc_from_icon_number(69, MAPSOURCE);
+                           wpt->icon_descr = gt_find_desc_from_icon_number(69, MAPSOURCE, NULL);
                        else
                            warning(MYNAME ": Unknown icon \"%s\" found. Please report.\n", str);
                }
@@ -279,7 +279,7 @@ bcr_route_header(const route_head *route)
            strncpy(symbol, "Standort", sizeof(symbol));
            if (wpt->icon_descr != 0)
            {
-               icon = mps_find_icon_number_from_desc(wpt->icon_descr, MAPSOURCE);
+               icon = gt_find_icon_number_from_desc(wpt->icon_descr, MAPSOURCE);
                if ((icon >= 69) && (icon <= 72))
                    strncpy(symbol, "Town", sizeof(symbol));
            }
index 2a63833f713802d8c8db78d6ed76400390543bf1..e6fc88c70fa23a7d52c95fa7ad8a152fb8600134 100644 (file)
@@ -22,6 +22,9 @@
 
 #include "garmin_tables.h"
 #include <stdio.h>
+#include <string.h>
+
+#define MYNAME "garmin_tables"
 
 /* MapSource 4.13 */
 icon_mapping_t garmin_icon_table[] = {
@@ -242,3 +245,399 @@ icon_mapping_t garmin_icon_table[] = {
        
        {    -1,    -1, NULL },
 };
+
+/* ICAO coutry code table */
+
+/* source: http://en.wikipedia.org/wiki/ICAO_airport_code */
+
+gt_country_code_t gt_country_codes[] = 
+{
+       { "ZM,", "Mongolia" }, 
+       { "ZK,", "North Korea" }, 
+       { "Z*,", "China" }, 
+       { "Y*,", "Australia" }, 
+       { "WS,", "Singapore" }, 
+       { "WM,", "Brunei/Malaysia" }, 
+       { "WB,", "Malaysia" }, 
+       { "WA,WI,WQ,WR,", "Indonesia" }, 
+       { "VV,", "Vietnam" }, 
+       { "VT,", "Thailand" }, 
+       { "VR,", "Maldives" }, 
+       { "VQ,", "Bhutan" }, 
+       { "VN,", "Nepal" }, 
+       { "VM,", "Macau" }, 
+       { "VL,", "Laos" }, 
+       { "VH,", "Hong Kong" }, 
+       { "VG,", "Bangladesh" }, 
+       { "VD,", "Kampuchea" }, 
+       { "VC,", "Sri Lanka" }, 
+       { "VB,VY,", "Myanmar/Burma" }, 
+       { "VA,VE,VI,VO,", "India" }, 
+       { "UR,", "Kazakhstan/Russia" }, 
+       { "UT,", "Kazakhstan/Tadzhikistan/Turkmenistan/Uzbekistan" }, 
+       { "UM,", "Belorussia/Russia" }, 
+       { "UK,", "Ukraine" }, 
+       { "UB,", "Azerbaijan" }, 
+       { "UA,", "Kazakhstan/Kirgizia" }, 
+       { "U*,", "Russia" }, 
+       { "TX,", "Bermuda" }, 
+       { "TV,", "St Vincent and the Grenadines" }, 
+       { "TU,", "British Virgin Islands" }, 
+       { "TT,", "Trinidad and Tobago" }, 
+       { "TR,", "Montserrat Island" }, 
+       { "TQ,", "Anguilla" }, 
+       { "TN,", "Aruba/Neth Antilles" }, 
+       { "TL,", "St Lucia" }, 
+       { "TK,", "St Kitts/Nevis Islands" }, 
+       { "TJ,", "Puerto Rico" }, 
+       { "TG,", "Grenada" }, 
+       { "TF,", "Guadeloupe/Martinique" }, 
+       { "TD,", "Dominica" }, 
+       { "TB,", "Barbados" }, 
+       { "TA,", "Antigua" }, 
+       { "SY,", "Guyana" }, 
+       { "SV,", "Venezuela" }, 
+       { "SU,", "Uruguay" }, 
+       { "SP,", "Peru" }, 
+       { "SO,", "French Guiana" }, 
+       { "SM,", "Suriname" }, 
+       { "SL,", "Bolivia" }, 
+       { "SK,", "Colombia/San Andres" }, 
+       { "SG,", "Paraguay" }, 
+       { "SF,", "Falkland Islands" }, 
+       { "SE,", "Ecuador" }, 
+       { "SC,", "Chile/Easter Island" }, 
+       { "SB,SD,SN,SS,SW,", "Brazil" }, 
+       { "SA,", "Argentina" }, 
+       { "S1,", "Antarctica (Argentina/Chile)" }, 
+       { "RP,", "Philippines" }, 
+       { "RK,", "South Korea" }, 
+       { "RJ,", "Japan" }, 
+       { "RC,", "Taiwan" }, 
+       { "PW,", "Wake Island" }, 
+       { "PT,", "Caroline Islands/Micronesia/Palau" }, 
+       { "PM,", "Midway Islands" }, 
+       { "PK,", "Marshall Islands" }, 
+       { "PJ,", "Johnston Atoll" }, 
+       { "PG,", "Guam/Mariana Islands/Northern Mariana Islands" }, 
+       { "PC,", "Kiribati" }, 
+       { "P",   "Oakland Octa" }, 
+       { "OY,", "Yemen Arab Rep" }, 
+       { "OT,", "Qatar" }, 
+       { "OS,", "Syria" }, 
+       { "OR,", "Iraq" }, 
+       { "OP,", "Pakistan" }, 
+       { "OO,", "Oman" }, 
+       { "OM,", "United Arab Emirates" }, 
+       { "OL,", "Lebanon" }, 
+       { "OK,", "Kuwait" }, 
+       { "OJ,", "Jordan" }, 
+       { "OI,", "Iran" }, 
+       { "OE,", "Saudi Arabia" }, 
+       { "OB,", "Bahrain" }, 
+       { "OA,", "Afghanistan" }, 
+       { "NZ,PL,", "New Zealand" }, 
+       { "NW,", "New Caledonia" }, 
+       { "NV,", "Vanuatu" }, 
+       { "NT,", "French Polynesia/Society Islands/Tuamotu Islands" }, 
+       { "NS,", "American Samoa/Western Samoa" }, 
+       { "NL,", "Futuna Island/Wallis Island" }, 
+       { "NI,", "Niue" }, 
+       { "NG,", "Kiribati/Tuvalu" }, 
+       { "NF,", "Fiji Island/Tonga" }, 
+       { "NC,", "Cook Islands" }, 
+       { "MZ,", "Belize" }, 
+       { "MY,", "Bahamas" }, 
+       { "MW,", "Cayman Islands" }, 
+       { "MU,", "Cuba" }, 
+       { "MT,", "Haiti" }, 
+       { "MS,", "El Salvador" }, 
+       { "MR,", "Costa rica" }, 
+       { "MP,", "Panama" }, 
+       { "MN,", "Nicaragua" }, 
+       { "MM,", "Mexico" }, 
+       { "MK,", "Jamaica" }, 
+       { "MI,TI,", "Virgin Islands (U.S.)" }, 
+       { "MH,", "Honduras" }, 
+       { "MG,", "Guatemala" }, 
+       { "MD,", "Dominican Republic" }, 
+       { "MB,", "Turks Island/Caicos Island" }, 
+       { "LZ,", "Slovakia" }, 
+       { "LY,", "Yugoslavia" }, 
+       { "LX,", "Gibraltar" }, 
+       { "LW,", "Macedonia" }, 
+       { "LV,", "Gaza" }, 
+       { "LU,", "Moldova" }, 
+       { "LT,", "Turkey" }, 
+       { "LS,", "Switzerland" }, 
+       { "LR,", "Romania" }, 
+       { "LQ,", "Bosnia-Herzegovina" }, 
+       { "LP,", "Portugal/Azores/Madeira Islands" }, 
+       { "LO,", "Austria" }, 
+       { "LN,", "Monaco" }, 
+       { "LM,", "Malta" }, 
+       { "LL,", "Israel/Jerusalem" }, 
+       { "LK,", "Czech" }, 
+       { "LI,", "Italy" }, 
+       { "LH,", "Hungary" }, 
+       { "LG,", "Slovenia" }, 
+       { "LG,", "Greece" }, 
+       { "LF,", "France" }, 
+       { "LF,", "Miquelon Island/St Pierre Island" }, 
+       { "LE,", "Spain" }, 
+       { "LD,", "Croatia" }, 
+       { "LC,", "Cyprus/Turkey (Northern Cyprus)" }, 
+       { "LB,", "Bulgaria" }, 
+       { "LA,", "Albania" }, 
+       { "K*,X*,PA,PB,PF,PJ,PL,PM,PO,PP,PH,PW,", "United States of America" }, 
+       { "HU,", "Uganda" }, 
+       { "HT,", "Tanzania" }, 
+       { "HS,", "Sudan" }, 
+       { "HR,", "Rwanda" }, 
+       { "HL,", "Libya, Spa Jamahiriya" }, 
+       { "HK,", "Kenya" }, 
+       { "HH,", "Eritrea" }, 
+       { "HE,", "Egypt" }, 
+       { "HD,HF,", "Djibouti" }, 
+       { "HC,", "Somalia" }, 
+       { "HB,", "Burundi" }, 
+       { "HA,", "Ethiopia" }, 
+       { "GV,", "Cape Verde" }, 
+       { "GU,", "Guinea Tepublic" }, 
+       { "GQ,", "Mauritania" }, 
+       { "GO,", "Senegal" }, 
+       { "GM,", "Morocco/Ad Dakhla/La'Youn" }, 
+       { "GL,", "Liberia" }, 
+       { "GG,", "Guinea-Bissau" }, 
+       { "GF,", "Sierra Leone" }, 
+       { "GE,", "Melilla" }, 
+       { "GC,", "Canary Island" }, 
+       { "GB,", "Gambia" }, 
+       { "GA,", "Mali" }, 
+       { "FZ,", "Democratic Republic of Congo" }, 
+       { "FY,", "Namibia" }, 
+       { "FX,", "Lesotho" }, 
+       { "FW,", "Malawi" }, 
+       { "FV,", "Zimbabwe" }, 
+       { "FT,", "Chad" }, 
+       { "FS,", "Seychelles" }, 
+       { "FQ,", "Mozambique" }, 
+       { "FP,", "Sao Tome & Principe" }, 
+       { "FO,", "Gabon" }, 
+       { "FN,", "Angola" }, 
+       { "FM,", "Madagascar/Comoros/Reunion/Mayotte Islands" }, 
+       { "FL,", "Zambia" }, 
+       { "FK,", "Cameroon" }, 
+       { "FJ,", "Chagos Archipelago/British Indian Ocean Territory" }, 
+       { "FI,", "Mauritius" }, 
+       { "FH,", "Ascension Island/St Helena Island" }, 
+       { "FG,", "Equitorial Guinea" }, 
+       { "FE,", "Central African Republic" }, 
+       { "FD,", "Swaziland" }, 
+       { "FC,", "Congo" }, 
+       { "FB,", "Botswana" }, 
+       { "FA,", "South African Republic" }, 
+       { "EY,", "Lithuania" }, 
+       { "EV,", "Latvia" }, 
+       { "ES,", "Sweden" }, 
+       { "EP,", "Poland" }, 
+       { "EN,", "Norway" }, 
+       { "EL,", "Luxembourg" }, 
+       { "EK,", "Denmark/Faroe Island" }, 
+       { "EI,", "Ireland" }, 
+       { "EH,", "Netherlands" }, 
+       { "EG,LX,", "United Kingdom" }, 
+       { "EF,", "Finland" }, 
+       { "EE,", "Estonia" }, 
+       { "ED,ET,", "Germany" }, 
+       { "EB,", "Belgium" }, 
+       { "DX,", "Togo" }, 
+       { "DT,", "Tunisia" }, 
+       { "DR,", "Niger" }, 
+       { "DN,", "Nigeria" }, 
+       { "DI,", "Ivory Coast" }, 
+       { "DG,", "Ghana" }, 
+       { "DF,", "Burkina Faso" }, 
+       { "DB,", "Benin" }, 
+       { "DA,", "Algeria" }, 
+       { "C*,", "Canada" }, 
+       { "BI,", "Iceland" }, 
+       { "BG,", "Greenland" }, 
+       { "AY,", "Papua New Guinea" }, 
+       { "AN,", "Nauru" }, 
+       { "AG,", "Solomon Island" }, 
+       { NULL, NULL }
+};
+
+/* gt_waypt_classes: gdb internal order */
+char *gt_waypt_class_names[] = {
+       "User Waypoint",
+       "Airport",
+       "Intersection",
+       "NDB",
+       "VOR",
+       "Runway Threshold",
+       "Airport Intersection",
+       "Airport NDB",
+       "Map Point",
+       "Map Area",
+       "Map Intersection",
+       "Map Address",
+       "Map Line",
+       NULL
+};
+
+/* gt_display_mode_names: this order is used by most devices */
+char *gt_display_mode_names[] = {
+       "Symbol & Name",
+       "Symbol",
+       "Symbol & Description"
+};
+
+char *
+gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic)
+{
+       icon_mapping_t *i;
+       char custom[] = "Custom 63";
+
+       if ((garmin_format == GDB) && (icon >= 500) && (icon <= 563))
+       {
+               snprintf(custom, sizeof(custom), "Custom %d", icon - 500);
+               *dynamic = 1;
+               return xstrdup(custom);
+       }
+
+       if (dynamic) *dynamic = 0;
+       
+       for (i = garmin_icon_table; i->icon; i++) {
+               switch (garmin_format) {
+                       case MAPSOURCE:
+                       case GDB:
+                               if (icon == i->mpssymnum)
+                                       return (char *)i->icon;
+                               break;
+                       case PCX:
+                       case GARMIN_SERIAL:
+                               if (icon == i->pcxsymnum)
+                                       return (char *)i->icon;
+                               break;
+                       default:
+                               fatal(MYNAME ": unknown garmin format.\n");
+               }
+       }
+       return DEFAULT_ICON_DESCR;
+}
+
+int gt_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_format)
+{
+       icon_mapping_t *i;
+       int def_icon = DEFAULT_ICON_VALUE;
+       int n;
+
+       if (!desc)
+               return def_icon;
+
+       /*
+        * If we were given a numeric icon number as a description 
+        * (i.e. 8255), just return that.
+        */
+       n = atoi(desc);
+       if (n)  {
+               return n;
+       }
+
+       if ((garmin_format == GDB) && (case_ignore_strncmp(desc, "Custom ", 7) == 0)) {
+               n = atoi((char *)desc + 7);
+               if ((n >= 0) && (n <= 63))
+                       return n+500;
+       }
+       for (i = garmin_icon_table; i->icon; i++) {
+               if (case_ignore_strcmp(desc,i->icon) == 0) {
+                       switch (garmin_format) {
+                       case MAPSOURCE:
+                       case GDB:
+                               return i->mpssymnum;
+                       case PCX:
+                       case GARMIN_SERIAL:
+                               return i->pcxsymnum;
+                       default:
+                               fatal(MYNAME ": unknown garmin format.\n");
+                       }
+               }
+       }
+       return def_icon;
+}
+
+char *
+gt_get_icao_country(const char *cc)
+{
+       gt_country_code_t *x = &gt_country_codes[0];
+
+       if ((cc == NULL) || (*cc == '\0')) return NULL;
+
+       do {
+               char *ccx = x->cc;
+               while (ccx != NULL) {
+                       if (strncmp(ccx, cc, 2) == 0) return x->country;
+                       if ((ccx[0] == cc[0]) && (ccx[1] == '*'))  return x->country;
+                       ccx = strchr(ccx, ',');
+                       if (ccx == NULL) break;
+                       ccx++;
+               }
+               x++;
+       } while (x->cc != NULL);
+       return NULL;
+}
+
+char *
+gt_get_icao_cc(const char *country, const char *shortname)
+{
+       static char res[3];
+       gt_country_code_t *x = &gt_country_codes[0];
+
+       if ((country == NULL) || (*country == '\0')) {
+               char *test;
+               if (shortname == NULL) return NULL;
+               switch(strlen(shortname)) {
+                       case 3: strncpy(res, shortname, 1); break;
+                       case 4: strncpy(res, shortname, 2); break;
+                       default: return NULL;
+               }
+               test = gt_get_icao_country(res);
+               if (test != NULL) 
+                       return res;
+               else
+                       return NULL;
+       }
+
+       do {
+               if (case_ignore_strcmp(country, x->country) != 0) {
+                       x++;
+                       continue;
+               }
+               
+               if (strlen(x->cc) <= 3) {
+                       strncpy(res, x->cc, 3);
+                       if (res[1] == '*')
+                               res[1] = '\0';
+                       else
+                               res[2] = '\0';
+                       return res;
+               }
+               if (shortname && (strlen(shortname) == 4)) {
+                       char *ccx = x->cc;
+                       
+                       strncpy(res, shortname, 2);
+                       res[2] = '\0';
+                       while (ccx != NULL) {
+                               if (strncmp(ccx, res, 2) == 0) return res;
+                               if ((ccx[0] == res[0]) && (ccx[1] == '*')) return res;
+                               ccx = strchr(ccx, ',');
+                               if (ccx == NULL) break;
+                               ccx++;
+                       }
+               }
+               return NULL;
+       } while (x->country != NULL);
+       return NULL;
+}
index 9b58383cbd9328aa3c7a480f2a4212e62005efdc..350a47f19513cbe877c87448a72588c6982eb4d6 100644 (file)
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
  */
 
+#ifndef GARMIN_TABLES_H
+#define GARMIN_TABLES_H
+
+#include "defs.h"
+
+#define DEFAULT_ICON_DESCR "Waypoint"
+#define DEFAULT_ICON_VALUE 18
+
 typedef struct icon_mapping {
        const int mpssymnum;
        const int pcxsymnum;
        const char *icon;
 } icon_mapping_t;
 
-typedef enum {MAPSOURCE, PCX, GARMIN_SERIAL} garmin_formats_e;
+typedef enum {MAPSOURCE, PCX, GARMIN_SERIAL, GDB} garmin_formats_e;
 
-extern const 
-char *mps_find_desc_from_icon_number(const int icon, 
-       garmin_formats_e garmin_format);
-extern int
-mps_find_icon_number_from_desc(const char *desc, 
-       garmin_formats_e garmin_format);
+char *gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic);
+int gt_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_format);
 
 extern icon_mapping_t garmin_icon_table[];
+
+typedef enum {
+       gt_waypt_class_user_waypoint = 0,
+       gt_waypt_class_airport,
+       gt_waypt_class_intersection,
+       gt_waypt_class_ndb,
+       gt_waypt_class_vor,
+       gt_waypt_class_runway_threshold,
+       gt_waypt_class_airport_intersection,
+       gt_waypt_class_airport_ndb,
+       gt_waypt_class_map_point,
+       gt_waypt_class_map_area,
+       gt_waypt_class_map_intersection,
+       gt_waypt_class_map_address,
+       gt_waypt_class_map_line
+} gt_waypt_classes_e;
+
+extern char *gt_waypt_class_names[];
+
+typedef struct gt_country_code_s 
+{ 
+       char *cc; 
+       char *country; 
+} gt_country_code_t;
+
+extern gt_country_code_t gt_country_codes[];
+
+char *gt_get_icao_country(const char *cc);
+char *gt_get_icao_cc(const char *country, const char *shortname);
+
+/* this order is used by most devices */
+typedef enum {
+       gt_display_mode_symbol_and_name = 0,
+       gt_display_mode_symbol,
+       gt_display_mode_symbol_and_comment
+} gt_display_modes_e;
+       
+extern char *gt_display_mode_names[];
+
+#define GT_DISPLAY_MODE_MIN gt_display_mode_symbol_and_name
+#define GT_DISPLAY_MODE_MAX gt_display_mode_symbol_and_comment
+
+typedef enum {
+       gt_gdb_display_mode_symbol = 0,
+       gt_gdb_display_mode_symbol_and_name,
+       gt_gdb_display_mode_symbol_and_comment
+} gt_gdb_display_modes_e;
+
+unsigned char gt_convert_category(const char *name, int *category);
+
+#endif
index e4a3a277494a240faa4da6fdf8a38619dc264b82..6444e651de6aac653da08848babc8742901ff12a 100644 (file)
@@ -278,7 +278,7 @@ data_read(void)
                          fi.i = le_read32(&rec->wpt.d108.dist);
                          wpt_tmp->proximity = fi.f;
                          wpt_tmp->wpt_flags.icon_descr_is_dynamic = 0;
-                         wpt_tmp->icon_descr = mps_find_desc_from_icon_number((rec->wpt.d108.smbl[1] << 8) + rec->wpt.d108.smbl[0], PCX);
+                         wpt_tmp->icon_descr = gt_find_desc_from_icon_number((rec->wpt.d108.smbl[1] << 8) + rec->wpt.d108.smbl[0], PCX, NULL);
                          waypt_add(wpt_tmp);
                          break;
 
index 703951ddf5bceaddb215fdbf340302c87c258b4d..1464d6811fea1474f801751a98eac7ab6e415c05 100644 (file)
@@ -171,65 +171,8 @@ mps_wpt_q_add(const queue *whichQueue, const waypoint *wpt)
        ENQUEUE_TAIL(whichQueue, &written_wpt->Q);
 }
 
-const char *
-mps_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format)
-{
-       icon_mapping_t *i;
-
-       for (i = garmin_icon_table; i->icon; i++) {
-               switch (garmin_format) {
-                       case MAPSOURCE:
-                               if (icon == i->mpssymnum)
-                                       return i->icon;
-                               break;
-                       case PCX:
-                       case GARMIN_SERIAL:
-                               if (icon == i->pcxsymnum)
-                                       return i->icon;
-                               break;
-                       default:
-                               fatal(MYNAME ": unknown garmin format.\n");
-               }
-       }
-       return DEFAULTICONDESCR;
-}
-
-int
-mps_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_format)
-{
-       icon_mapping_t *i;
-       int def_icon = DEFAULTICONVALUE;
-       int n;
-
-       if (!desc)
-               return def_icon;
-
-       /*
-        * If we were given a numeric icon number as a description 
-        * (i.e. 8255), just return that.
-        */
-       n = atoi(desc);
-       if (n)  {
-               return n;
-       }
-
-       for (i = garmin_icon_table; i->icon; i++) {
-               if (case_ignore_strcmp(desc,i->icon) == 0) {
-                       switch (garmin_format) {
-                       case MAPSOURCE:
-                               return i->mpssymnum;
-                       case PCX:
-                       case GARMIN_SERIAL:
-                               return i->pcxsymnum;
-                       default:
-                               fatal(MYNAME ": unknown garmin format.\n");
-                       }
-               }
-       }
-       return def_icon;
-}
-
-int mps_converted_icon_number(const int icon_num, const int mpsver, garmin_formats_e garmin_format)
+static int 
+mps_converted_icon_number(const int icon_num, const int mpsver, garmin_formats_e garmin_format)
 {
        int def_icon = DEFAULTICONVALUE;
 
@@ -559,6 +502,7 @@ mps_waypoint_r(FILE *mps_file, int mps_ver, waypoint **wpt, unsigned int *mpscla
        int lat;
        int lon;
        int     icon;
+       int dynamic;
 
        waypoint        *thisWaypoint = NULL;
        double  mps_altitude = unknown_alt;
@@ -643,7 +587,8 @@ mps_waypoint_r(FILE *mps_file, int mps_ver, waypoint **wpt, unsigned int *mpscla
        thisWaypoint->depth = mps_depth;
 
        /* might need to change this to handle version dependent icon handling */
-       thisWaypoint->icon_descr = mps_find_desc_from_icon_number(icon, MAPSOURCE);
+       thisWaypoint->icon_descr = gt_find_desc_from_icon_number(icon, MAPSOURCE, &dynamic);
+       thisWaypoint->wpt_flags.icon_descr_is_dynamic = dynamic;
 
        /* The following Now done elsewhere since it can be useful to read in and 
          perhaps not add to the list */
@@ -686,10 +631,10 @@ mps_waypoint_w(FILE *mps_file, int mps_ver, const waypoint *wpt, const int isRou
        memset(ffbuf, 0xff, sizeof(ffbuf));
 
        /* might need to change this to handle version dependent icon handling */
-       icon = mps_find_icon_number_from_desc(wpt->icon_descr, MAPSOURCE);
+       icon = gt_find_icon_number_from_desc(wpt->icon_descr, MAPSOURCE);
 
        if (get_cache_icon(wpt) /* && wpt->icon_descr && (strcmp(wpt->icon_descr, "Geocache Found") != 0)*/) {
-               icon = mps_find_icon_number_from_desc(get_cache_icon(wpt), MAPSOURCE);
+               icon = gt_find_icon_number_from_desc(get_cache_icon(wpt), MAPSOURCE);
        }
 
        icon = mps_converted_icon_number(icon, mps_ver, MAPSOURCE);
index 1d76a3de118a7586631a8eb6ca5f07dea9f5ee90..5600c06ceb365fc6dbd0643fa81f53b4512e6da0 100644 (file)
@@ -125,7 +125,7 @@ data_read(void)
                        if (*cp != '\0') {
                                wpt_tmp->description = xstrdup(cp);
                        }
-                       wpt_tmp->icon_descr = mps_find_desc_from_icon_number(symnum, PCX);
+                       wpt_tmp->icon_descr = gt_find_desc_from_icon_number(symnum, PCX, NULL);
 
                        if (latdir == 'S') lat = -lat;
                        if (londir == 'W') lon = -lon;
@@ -240,9 +240,9 @@ gpsutil_disp(const waypoint *wpt)
        if (deficon) {
                icon_token = atoi(deficon);
        } else {
-               icon_token = mps_find_icon_number_from_desc(wpt->icon_descr, PCX);
+               icon_token = gt_find_icon_number_from_desc(wpt->icon_descr, PCX);
                if (get_cache_icon(wpt)) {
-                       icon_token = mps_find_icon_number_from_desc(get_cache_icon(wpt), PCX);
+                       icon_token = gt_find_icon_number_from_desc(get_cache_icon(wpt), PCX);
                }
        }
 
index 76d1992e35b13f12d917bb0c0083c1f991dcf520..3eda2eb45e3506c9b64f97ba2d30c99478701596 100755 (executable)
@@ -313,7 +313,7 @@ psit_waypoint_r(FILE *psit_file, waypoint **wpt)
                /* since PsiTrex only deals with Garmins, let's use the "proper" Garmin icon name */
                /* convert the PsiTrex name to the number, which is the PCX one; from there to Garmin desc */
                garmin_icon_num = psit_find_icon_number_from_desc(psit_current_token);
-               thisWaypoint->icon_descr = mps_find_desc_from_icon_number(garmin_icon_num, PCX);
+               thisWaypoint->icon_descr = gt_find_desc_from_icon_number(garmin_icon_num, PCX, NULL);
 
                waypt_add(thisWaypoint);
 
@@ -347,10 +347,10 @@ psit_waypoint_w(FILE *psit_file, const waypoint *wpt)
                                wpt->shortname;
 
        fprintf(psit_file, " %-6s, ", ident);
-       icon = mps_find_icon_number_from_desc(wpt->icon_descr, PCX);
+       icon = gt_find_icon_number_from_desc(wpt->icon_descr, PCX);
 
        if (get_cache_icon(wpt) && wpt->icon_descr && (strcmp(wpt->icon_descr, "Geocache Found") != 0)) {
-               icon = mps_find_icon_number_from_desc(get_cache_icon(wpt), PCX);
+               icon = gt_find_icon_number_from_desc(get_cache_icon(wpt), PCX);
        }
 
        ident = psit_find_desc_from_icon_number(icon);
@@ -434,7 +434,7 @@ psit_route_r(FILE *psit_file, route_head **rte)
                        /* since PsiTrex only deals with Garmins, let's use the "proper" Garmin icon name */
                        /* convert the PsiTrex name to the number, which is the PCX one; from there to Garmin desc */
                        garmin_icon_num = psit_find_icon_number_from_desc(psit_current_token);
-                       thisWaypoint->icon_descr = mps_find_desc_from_icon_number(garmin_icon_num, PCX);
+                       thisWaypoint->icon_descr = gt_find_desc_from_icon_number(garmin_icon_num, PCX, NULL);
 
                        route_add_wpt(rte_head, thisWaypoint);